<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>

<?php
$attributes = array(
    'class' => 'control-label',
);
?>
<div class="span9">
    <h3><?php echo $titulo . ' ' . $medico->nombre . '. (Mat: ' . $medico->matricula . ')'; ?></h3> 
    <?php echo get_message(); ?> 
    <?php echo form_open(); ?> 
    <div class="control-group" style="display:none">
        <?php echo form_label('Matrícula', 'matricula', $attributes); ?>
        <div class="controls">
            <?php echo form_input(array('class' => 'span5', 'name' => 'matricula', 'type' => 'text', 'editable' => 'false', 'value' => $medico->matricula)); ?>
        </div>
    </div> 
    <div class="control-group">
        <?php echo form_label('Fecha del acto médico', 'fecha', $attributes); ?>
        <div class="controls input-append">
            <?php
            echo form_input(array('class' => 'span5 date-picker', 'data-date-format' => 'dd/mm/yyyy', 'name' => 'fechaActoMedico', 'type' => 'text', 'value' => $consulta['fechaActoMedico']));
            ?><span class="add-on"><i class="icon-calendar"></i></span>
        </div>
    </div>

    <div class="control-group">
        <?php echo form_label('Tipo de consulta', 'tipoConsultaId', $attributes); ?>
        <div class="controls">
            <?php
            echo form_dropdown('tipoConsultaId', $tipo_consulta, $consulta['tipoConsultaId'], 'class="span6" id="tipoId"');
            ?>
        </div>
    </div>
    <div class="control-group">
        <?php echo form_label('Motivo de la consulta', 'motivo', $attributes); ?>
        <div class="controls">
            <?php echo form_textarea(array('class' => 'span8', 'rows' => '5', 'name' => 'motivo', 'type' => 'text', 'value' => $consulta['motivo'])); ?> 
        </div>
    </div> 
    <div  class="control-group">
        Seleccione los presentes a la reunión:
        <?php
        count($asesores);
        foreach ($asesores as $asesor) {
            ?> 
            <label class="checkbox" style="margin-left:20px;">
                <?php
                if (is_array($consulta['asesor'])) {
                    if (in_array($asesor->id, $consulta['asesor'])) {
                        $checked = TRUE;
                    } else {
                        $checked = FALSE;
                    }
                } else {
                    $checked = FALSE;
                }
                
                echo form_checkbox('asesor[]', $asesor->id, $checked, ' dbid="' . $asesor->id . '"');
                echo '' . $asesor->nombre . ' (' . $asesor->cargo . ')';
                ?> 
            </label>
            <?php
        }
        ?>
    </div>
    <div class="control-group">
        <div class="controls">
            <?php echo form_input(array('class' => 'span6', 'name' => 'submit', 'type' => 'submit', 'value' => 'Guardar', 'class' => 'btn')); ?>
            <button type="button" onclick="window.location = '<?php echo base_url('consultas'); ?>';" class="btn">Cancelar</button>
        </div>

    </div>
    <?php echo form_close(); ?>

</div>